
package cakeorcookiexample.works;

import controlisolation.lifecyclefsm.stateexecutor.StateWork;
import java.util.Random;
import java.util.logging.Level;


public class GenerateAorOWork extends StateWork{

    @Override
    public void doWork()  {
        _logger.log(Level.INFO,"[A or O]");
        addInfoMessage(100, "CLASS:"+this.getClass().getName());
        Random random= (Random)this.getGlobals().get("RANDOM_GENERATOR");
        
        String produced="";
        
        int rnd=random.nextInt(100);
        if (rnd%2==0)
        {
            produced="A";
        } else
        {
            produced="O";
        }
        
        pauseFor(100);
        
        String previously_produced=(String)this.getWorkInputs().get("PRODUCED");
        this.getWorkOutputs().put("PRODUCED",previously_produced+produced);
        
    }

}
